using System.Runtime.CompilerServices;
using SageKing.Designer.Core.Helpers;
using SageKing.Designer.Core;
using SageKing.Designer.Core.Attributes;
using SageKing.Designer.Core.Contracts; 
using SageKing.Designer.Core.Models;

namespace SageKing.Designer.Core.Activities;

/// <summary>
/// Schedule an activity for each item in parallel.
/// </summary>
/// <typeparam name="T"></typeparam>
[Activity("SageKing", "Looping", "Schedule an activity for each item in parallel.")]
public class ParallelForEach<T> : Activity
{
    private const string ScheduledTagsProperty = nameof(ScheduledTagsProperty);
    private const string CompletedTagsProperty = nameof(CompletedTagsProperty);

    /// <inheritdoc />
    public ParallelForEach([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
    {
    }

    /// <summary>
    /// The items to iterate.
    /// </summary>
    [Input(Description = "The items to iterate through.")]
    public Input<object> Items { get; set; } = new(Array.Empty<T>());

    /// <summary>
    /// The <see cref="IActivity"/> to execute each iteration.
    /// </summary>
    [Port]
    public IActivity Body { get; set; } = default!;
     
}